/**
 * 
 */
package com.swim.settlementrecord.entity;

import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.swim.settlementapply.entity.SettlementApply;

/**
 * 结算记录Entity
 * @author 刘军武
 * @version 2021-03-05
 */
@Table(name="t_settlement_record", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="settlement_apply_id", attrName="settlementApplyId", label="结算申请表id"),
		@Column(name="natatorium_info_id", attrName="natatoriumInfoId", label="游泳馆信息id"),	
		@Column(name="settlement_amount", attrName="settlementAmount", label="结算金额"),
		@Column(name="settlement_account", attrName="settlementAccount", label="结算账号"),
		@Column(name="trade_information", attrName="tradeInformation", label="交易信息"),
		@Column(name="clearing_form", attrName="clearingForm", label="结算方式"),
		@Column(name="settlement_time", attrName="settlementTime", label="结算时间"),
		@Column(includeEntity=DataEntity.class),
	},  joinTable={
			@JoinTable(type=Type.LEFT_JOIN, entity=SettlementApply.class, alias="sa", on="a.settlement_apply_id = sa.id", attrName="settlementApply", 
					columns={
							@Column(includeEntity=SettlementApply.class)
					}),
	},orderBy="a.update_date DESC"
)
public class SettlementRecord extends DataEntity<SettlementRecord> {
	
	private static final long serialVersionUID = 1L;
	private String settlementApplyId;		// 结算申请表id
	private String natatoriumInfoId;		// 游泳馆信息id
	private Double settlementAmount;		// 结算金额
	private String settlementAccount;		// 结算账号
	private String tradeInformation;		// 交易信息
	private String clearingForm;		// 结算方式
	private Date settlementTime;		// 结算时间
	
	//############ 附加属性 #############
	private String submitter; // 提交人
	private SettlementApply settlementApply; // 结算申请实体
	
	public SettlementRecord() {
		this(null);
	}

	public SettlementApply getSettlementApply() {
		return settlementApply;
	}

	public void setSettlementApply(SettlementApply settlementApply) {
		this.settlementApply = settlementApply;
	}

	public String getSubmitter() {
		return submitter;
	}

	public void setSubmitter(String submitter) {
		this.submitter = submitter;
	}

	public SettlementRecord(String id){
		super(id);
	}
	
	@NotBlank(message="结算申请id不能为空")
	@Length(min=0, max=64, message="结算申请id长度不能超过 64 个字符")
	public String getSettlementApplyId() {
		return settlementApplyId;
	}

	public void setSettlementApplyId(String settlementApplyId) {
		this.settlementApplyId = settlementApplyId;
	}
	
	@NotBlank(message="游泳馆信息id不能为空")
	@Length(min=0, max=64, message="游泳馆信息id长度不能超过 64 个字符")
	public String getNatatoriumInfoId() {
		return natatoriumInfoId;
	}

	public void setNatatoriumInfoId(String natatoriumInfoId) {
		this.natatoriumInfoId = natatoriumInfoId;
	}

	@NotNull(message="结算金额不能为空")
	public Double getSettlementAmount() {
		return settlementAmount;
	}

	public void setSettlementAmount(Double settlementAmount) {
		this.settlementAmount = settlementAmount;
	}
	
	@NotBlank(message="结算账号不能为空")
	@Length(min=0, max=30, message="结算账号长度不能超过 30 个字符")
	public String getSettlementAccount() {
		return settlementAccount;
	}

	public void setSettlementAccount(String settlementAccount) {
		this.settlementAccount = settlementAccount;
	}
	
	@NotBlank(message="交易信息不能为空")
	@Length(min=0, max=100, message="交易信息长度不能超过 100 个字符")
	public String getTradeInformation() {
		return tradeInformation;
	}

	public void setTradeInformation(String tradeInformation) {
		this.tradeInformation = tradeInformation;
	}
	
	@NotBlank(message="结算方式不能为空")
	@Length(min=0, max=10, message="结算方式长度不能超过 10 个字符")
	public String getClearingForm() {
		return clearingForm;
	}

	public void setClearingForm(String clearingForm) {
		this.clearingForm = clearingForm;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@NotNull(message="结算时间不能为空")
	public Date getSettlementTime() {
		return settlementTime;
	}

	public void setSettlementTime(Date settlementTime) {
		this.settlementTime = settlementTime;
	}
	
}